<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TypeRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>'required|unique:shop_type,name',
            'sort'=>'required|digits_between:1,999',
            'picname' => 'required',
        ];
    }

    public function message(){
        return [
            'name.required' => '分类不能为空',
            'name.unique' => '该账号已存在',
            'sort.required' => '请输入排序',
            'sort.digits_between' => '排序应为 1到999 之间',
            'picname.required' => 'Logo不能为空',
        ];
    }
}
